﻿using System.Diagnostics;
using System.Linq;
using log4net;
using OrbitOne.Elmah.Data;

namespace OrbitOne.Elmah.Logic
{
    /// <summary>
    /// Represents an ElmahService.
    /// </summary>
    /// <typeparam name="T">The type of the entities you wich to get.</typeparam>
    /// <remarks>This is an abstract class.</remarks>
    public class ElmahService<T> 
    {
        #region Member Variables
        protected static readonly ILog _logger = LogManager.GetLogger(typeof(ElmahService<T>));
        [DebuggerBrowsable(DebuggerBrowsableState.Never)]
        private ElmahDataProvider _provider; 
        #endregion

        #region Properties

        protected ILog Log = LogManager.GetLogger(typeof (T));

        /// <summary>
        /// Gets the provider of the ElmahService.
        /// </summary>
        public ElmahDataProvider Provider
        {
            get
            {
                if (_provider == null)
                {
                    _provider = new ElmahDataProvider();
                }
                return _provider;
            }
            protected set { _provider = value; }
        } 
        #endregion

        #region Public Methods
        #endregion
    }
}